<template>
	<view class="container">
		<view class="item flex-just-between" @click="showPop">
			<view class="left">
				<image src="/static/login-pwd.png" mode=""></image>
				<text>{{ $t('security.accountCancellation') }}</text>
			</view>
			<uni-icons type="right" :size="24"></uni-icons>
		</view>

		<!-- 注销弹出层，通过 v-if 控制显示隐藏 -->
		<uni-popup v-if="showPopup" ref="popup" background-color="#fff" @change="change" borderRadius="72rpx 72rpx 0 0">
			<view class="popup-content">
				<view class="title">{{ $t('security.deleteAccountReminder') }}</view>
				<view class="text-info">
					<view>{{ $t('security.accountDeleteInfo1') }}</view>
					<view>{{ $t('security.accountDeleteInfo2') }}</view>
				</view>
				<view class="again-btn" @click="hidePopup">{{ $t('security.thinkAgain') }}</view>
				<view class="confirm-btn" @click="confirmDeleteAccount">{{ $t('security.confirmAccountCancellation') }}
				</view>
			</view>
		</uni-popup>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				showPopup: false // 控制弹出层显示隐藏
			};
		},
		methods: {
			showPop() {
				this.showPopup = true;
				this.$refs.popup.open('bottom');
			},
			hidePopup() {
				this.showPopup = false;
				this.$refs.popup.close();
			},
			confirmDeleteAccount() {
				// 这里添加真正的账户注销逻辑，比如调用接口
				uni.showToast({
					title: this.$t('security.accountDeletionSuccess'),
					icon: 'none'
				});
				this.showPopup = false;
				this.$refs.popup.close();
			}
		}
	};
</script>

<style lang="less" scoped>
	.container {
		min-height: 93.2vh;
		background-color: #F7F7F7;

		.item {
			height: 110rpx;
			font-size: 32rpx;
			background-color: #fff;
			padding: 0 52rpx;

			image {
				margin-right: 30rpx;
				width: 36rpx;
				height: 36rpx;
			}
		}

		.popup-content {
			padding: 36rpx 48rpx 32rpx;

			.title {
				margin-bottom: 48rpx;
				text-align: center;
				font-size: 32rpx;
			}

			.text-info {
				font-size: 28rpx;
				color: #999;
				line-height: 44rpx;

				view {
					margin-bottom: 48rpx;
				}
			}

			.again-btn {
				margin-bottom: 32rpx;
				width: 648rpx;
				height: 100rpx;
				line-height: 100rpx;
				background-color: #52A5F3;
				border-radius: 50rpx;
				font-size: 32rpx;
				color: #fff;
				text-align: center;
			}

			.confirm-btn {
				text-align: center;
				font-size: 32rpx;
				color: #999;
			}
		}
	}
</style>